package cn.jhz.learn.blog.dao.article;

import cn.jhz.learn.blog.po.article.BlogArticle;
import cn.jhz.learn.blog.vo.article.query.count.ArticleCount;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BlogArticleMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(BlogArticle record);

    int insertSelective(BlogArticle record);

    BlogArticle selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(BlogArticle record);

    int updateByPrimaryKey(BlogArticle record);

    /*自定义*/
    List<BlogArticle> selectHotByBlogIdOrSubfieldId(@Param("blog_id") Integer blog_id,
                                                        @Param("subfield_id") Integer subfieldId,
                                                        @Param("type") List<Byte> type,
                                                        @Param("visibility") List<Byte> visibility,
                                                        @Param("status") List<Byte> status);

    List<BlogArticle> selectAccessByBlogIdOrSubfieldId(@Param("blog_id") Integer blog_id,
                                                           @Param("subfield_id") Integer subfieldId,
                                                           @Param("type") List<Byte> type,
                                                           @Param("visibility") List<Byte> visibility,
                                                           @Param("status") List<Byte> status);

    List<BlogArticle> selectLatestByBlogIdOrSubfieldId(@Param("blog_id") Integer blog_id,
                                                           @Param("subfield_id") Integer subfieldId,
                                                           @Param("type") List<Byte> type,
                                                           @Param("visibility") List<Byte> visibility,
                                                           @Param("status") List<Byte> status);

    ArticleCount countByBlogId(@Param("blog_id") Integer blogId);
}